package com.financial.service.heemoney.service.impl;

import com.financial.service.heemoney.service.HeemoneyReportRegisterService;
import com.financial.service.heemoney.utils.JsonUtils;
import com.financial.service.heemoney.utils.apiresult.ApiResult;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * @api {post}
 * @apiExample author zhaopengjun
 * tar 汇收银商户基础信息注册服务类
 * date 11:28 2019/11/7
 * @apiGroup
 * @apiVersion 1.0.0
 * @apiHeader
 * @apiParam
 * @apiSuccess
 */
@Service
public class HeemoneyReportRegisterServiceImpl implements HeemoneyReportRegisterService {
    @Override
    public ApiResult register(String params) {
        //解析json参数串
        Object temp = "";
        Map<String, Object> changeMap = JsonUtils.jsonToMap(params);
        //公司名称
        String company = changeMap.get("company").toString();
        //联系人
        String contactName = changeMap.get("contact_name").toString();
        //联系人手机号
        String contactMobile = changeMap.get("contact_mobile").toString();
        //备注(非必填)
        temp = changeMap.get("remark");
        String remark = temp != null ? changeMap.get("remark").toString() : null;

        if (StringUtils.isEmpty(company) || StringUtils.isEmpty(contactName) || StringUtils.isEmpty(contactMobile)) {
            return ApiResult.paramIsNull();
        }

        //封装公共参数以及业务参数
        Map<String, String> paramsMap = new HashMap<>();
        paramsMap.put("method", "ysepay.df.single.quick.accept");
      /*  paramsMap.put("version", HeemoneyConfigDTO.);
        paramsMap.put("isv_mch_uid", ysPayDTO.getPARTNER_ID());
        paramsMap.put("isv_app_id", );
        paramsMap.put("charset", ysPayDTO.getDEFAULT_CHARSET());
        paramsMap.put("sign_type", ysPayDTO.getSIGN_ALGORITHM());
        paramsMap.put("timestamp", DateFormatHelper.getNowTimeStr());
        //paramsMap.put("biz_content", bizContent);
        sign*/
        return null;
    }
}
